<template>
    <div class="shopcar-container">
        <div class="goodslist">
        <!-- 商品列表区域 -->
        <div class="mui-card">
				<div class="mui-card-content">
					<div class="mui-card-content-inner">
						<mt-switch></mt-switch>
                        <img src="http://ofv795nmp.bkt.clouddn.com//upload/201504/20/thumb_201504200046589514.jpg">
                        <div class="info">
                            <h1>华为（HUAWEI）荣耀6Plus 16G双4G版</h1>
                            <P>
                                <span class="price">￥2195</span>
                                <numbox></numbox>
                                <a href="#">删除</a>
                            </P>
                        </div>
                    </div>
				</div>
		</div>

        <!-- 商品结算区域 -->
        <div class="mui-card">
				<div class="mui-card-content">
					<div class="mui-card-content-inner jiesuan">
						<div class="left">
                            <p>
                                总计:(不含运费)
                            </p>
                            <P>
                                已勾选商品<span class="red">0</span>件,总价 ￥<span class="red">2199</span>
                            </P>
                        </div>
                        <mt-button type="danger">去结算</mt-button>
					</div>
				</div>
		</div>
        </div>
    </div>
</template>

<script>
import  numbox from '../subcomponents/shopcar_numbox.vue';
import { Toast } from "mint-ui";
export default {
    data(){
        return {
            goodslist:[],
        }
    },
    created(){
        this.getGoodsList();
    },
    methods:{
        getGoodsList(){
            var idArr = [];
            this.$store.state.car.forEach(item => idArr.push(item.id));

            if(idArr.length < 0){
                return;
            }
            this.$http.get("https://www.sinya.online/api/goods/getshopcarlist/" + idArr.join(","))
            .then(result => {
                if(result.body.status === 0){
                    this.goodslist = result.body.message;
                    Toast('购物车读取成功');
                }else{
                    Toast('购物车读取失败');
                }
            });
       }
    },
    components:{
        numbox
    }
}
</script>

<style lang="less" scoped>
    .shopcar-container{
        overflow: hidden;
        .mui-card-content-inner{
            display:flex;
            align-items: center;
        }
    }
    .goodslist{
        img{
            width:60px;
            height:60px;
        }
        h1{
            font-size:14px;
        }
        .info{
            padding:4px;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            .price{
                color: red;font-weight: bold;
            }
        }
    }
    .jiesuan{
        display:flex;
        justify-content: space-between;
        align-items: center;
    }
    .red{
        color:red;
    }
</style>